package string_test;

import java.util.Locale;

public class OtherString {
    public static void main(String[] args) {
        String str1 = "hello";
        String str2 = "h";
        String str3=" ";
        System.out.println(firstUpper(str1));
        System.out.println(firstUpper(str2));
        System.out.println(firstUpper(str3));

    }
    public static String firstUpper(String str){
        //判空处理
        if (str == null||str.isEmpty()){
            return null;
        }
        //边界条件
        if (str.length() ==1){
            return str.toUpperCase();
        }
        //此时长度大于一
        //截取+大写操作
        return str.substring(0,1).toUpperCase()+str.substring(1);
    }
}
